import request from "@/utils/request";
import PageResult from "@/types/global";
import { DictVO } from "@/api/system/dict";
import {searchShipQuery, SearchShipVo} from "@/api/search-ship";

const GENERATOR_BASE_URL = "/client";

const ShipAPI = {
  /** 获取首页船舶分页列表 */
  getHomeShipList(param) {
    return request<any, PageResult<SearchShipVo[]>>({
      url: `${GENERATOR_BASE_URL}/auth/ship/homeList?` + param,
      method: "post",
    });
  },

  /** 获取数据表分页列表 */
  getShipDetail(data: any) {
    return request<any, PageResult<ShipVo[]>>({
      url: `${GENERATOR_BASE_URL}/ship/ship/pc/${data.sid}`,
      method: "get",
    });
  },


  /** 申请三级权限 */
  applyLevel3Permission(data: any) {
    return request<any, PageResult<ShipVo[]>>({
      url: `${GENERATOR_BASE_URL}/ship/apply`,
      method: "post",
      data
    });
  },


  /** 获取船东代理的船只列表 */
  getUserShipList(data: any) {
    return request<any, PageResult<ShipVo[]>>({
      url: `${GENERATOR_BASE_URL}/ship/ship/pcUserMidShipList`,
      method: "get",
    });
  },


  /** 获取船舶文档列表 */
  getShipDocumentList(data: any) {
    return request<any, PageResult<ShipVo[]>>({
      url: `${GENERATOR_BASE_URL}/ship/document/list`,
      method: "get",
      params: data
    });
  },

  /** 保存船舶文档列表 */
  saveShipDocumentList(data: any) {
    return request<any, any>({
      url: `${GENERATOR_BASE_URL}/ship/document/save`,
      method: "post",
      data
    });
  },

  /** 删除船舶文档关联 */
  delDocument(id) {
    return request<any, any>({
      url: `${GENERATOR_BASE_URL}/ship/document/${id}`,
      method: "delete",
    });
  },

  /** 船东编辑我的船 */
  updateShip(data) {
    return request<any, any>({
      url: `${GENERATOR_BASE_URL}/ship/ship`,
      method: "put",
      data
    });
  }


};

export default ShipAPI;

/** 返回的船舶详情对象 */
export interface ShipVo {}
